package com.grandt.view.utils;

import java.util.List;

import javax.swing.JTable;
import javax.swing.table.DefaultTableModel;

import com.grandt.model.beans.DataTableBean;

public class ManagerTable {

	private JTable	tabla;
	public ManagerTable(JTable table) {
		this.tabla = table;
	}
	public void initData(List<DataTableBean> list){
		clearAllRows();
		for (DataTableBean bean : list) {
			((DefaultTableModel)tabla.getModel()).addRow(bean.toVector());
		}
	}
	private void clearAllRows(){
		int rows = tabla.getRowCount();
		for (int i = 0; i < rows; i++) {
			((DefaultTableModel)tabla.getModel()).removeRow(0);
		}
	}
}
